/**
 * ********************************************************
 * <p>
 * Copyright (c) 2018 Baidu.com, Inc. All Rights Reserved
 * <p>
 * ********************************************************
 *
 * @date: 2018年10月26日
 * @author: zhangliuqing01
 * @description:
 */
package com.baidu.mpks.backendweb.ktree.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.util.Date;

@Data
@NoArgsConstructor
public class TreeNode {
    
    private Integer id;
    @NotBlank(message = "名称不能为空")
    @Length(message = "名称不能超过50个字", min = 1, max = 50)
    @Pattern(regexp = "^[A-Za-z0-9\\u4e00-\\u9fa5\"'“”()（）_.-]+、$", message = "名称只支持中英文/数字/双引号/冒号/括号/下划线/短横线/点/顿号")
    private String name;
    private Integer parentId;
    private Integer sort;
    // 是否可编辑
    private Integer edit;
    // 是否可删除
    private Integer delete;

    private Integer isEncryption;

    private String createBy;
    private String updateBy;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    public TreeNode(String userId) {
        this.setCreateBy(userId);
        this.setUpdateBy(userId);
    }
}
